$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    const mstform = $NG.getCmpApi("p_form_yzhtbcxy_m")
    const dgrid1 = $NG.getCmpApi("")
    const getHeadValue = (str) => mstform.getItem(str).getValue()
    const user = $NG.getUser()
    useValuesChange(() => {
        const PhidCnt = mstform.getItem("u_htmc").getValue()
        if (!PhidCnt) return
        const datas = mstform.getItem("u_htmc").getOrigin()
        $NG.execServer("getCntCbInfoByPhid", { phid: PhidCnt }, (res) => {
            if (res.count == 0) {
                return
            }
            const datas = JSON.parse(res.data)[0].extendObjects
            console.log(`datas`, datas);
            const arr = [
                {
                    key: 'u_xmssdw',
                    value: {
                        value: datas.xmssdw_phid,
                        label: datas.xmssdw_name
                    }
                },
                {
                    key: 'u_jfdw',
                    value: {
                        value: datas.jfdw_phid,
                        label: datas.jfdw_name
                    }
                },
                {
                    key: 'u_htje',
                    value: datas.Cnt_sum_vat_fc
                },
                {
                    key: 'bill_no',
                    value: datas.cnt_no
                },
            ]
            setHeadValues(arr)
        })

    }, "p_form_yzhtbcxy_m.u_htmc")

    // 表头批量赋值
    function setHeadValues(arr) {
        arr.forEach(item => {
            mstform.getItem(item.key)?.setValue(item.value)
        })
    }
})